<?php namespace Common\Model;
use \Hdphp\Model\Model;
/*
 * 类型模型1
 * */
 class type extends Model
 {
 	protected $table = "type";
	protected $validate = array(
		array("tname","required","请输入类型名称",3,3),
	);
	
	public function addtype()
	{
		if(!$this->create()) return FALSE;
		//检查是否重复
		$date = $this->where("tname",$_POST["tname"])->first();
		if($date){
			$this->error = "该类别已存在";
			return FALSE;
		}
		return $this->add();
	}
 }
